package mortal.game.control
{
    import Message.Public.*;
    import modules.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class CareerController extends Controller
    {

        public function CareerController()
        {
            
        }

        private function onCareerUpdateHandler(event:DataEvent) : void
        {
            var _loc_2:int = 0;
            if (cache.role.roleInfo.career == ECareer._ECareerNewPlayer || cache.role.roleInfo.career == ECareer._ECareerNo)
            {
                _loc_2 = int(event.data);
                GameProxy.career.updateCareerReq(_loc_2);
                cache.guide.selectedCareer = true;
                Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_UpdateCareer));
            }
            
        }

        private function onWindowShow(event:WindowEvent) : void
        {
            (_view as ICareerModule).updateCareerList(cache.career.careers);
            
        }

        override protected function initView() : IView
        {
            var _loc_1:* = new CareerModule();
            _loc_1.addEventListener(EventName.Career_Update, this.onCareerUpdateHandler);
            _loc_1.addEventListener(WindowEvent.SHOW, this.onWindowShow);
            return _loc_1;
        }

        override protected function initServer() : void
        {
            super.initServer();
            
        }

    }
}
